using System;
using System.Collections.Generic;
using System.Text;
using BHBC.Entity;
using ZFrameWork.Util;

namespace BHBC.BC.User
{
    public class UserReg
    {
        public static int CommUserRegister( Entity.TbUserAccountInfo ucInf)
        {
            string sql = "insert into tb_UserAccount(UserID, NickName, Passwd, type,mobile,email) values(@userid, @nickname, @passwd, @type, @mobile, @email)";
            ParamsBuilder pb = new ParamsBuilder();
            pb.Append("@userid", ucInf.UserID);
            pb.Append("@nickname", ucInf.UserID);
            pb.Append("@passwd", ucInf.Passwd);
            pb.Append("@type", 0);
            pb.Append("@mobile", ucInf.Mobile);
            pb.Append("@email", ucInf.Email);
            return ZFrameWork.DB.TableAccess.ExecuteNoneQueryWithParameters(PubMemContainer.YiooyiDB, sql, pb.GetParams());
        }

        public static int CheckUserExist( string user )
        {
            string sql = "select 1 from tb_UserAccount where UserID=@u";
            ParamsBuilder pb = new ParamsBuilder();
            pb.Append("@u", user);
            int tag = ZFrameWork.DB.TableAccess.ExecuteScalarWithParameters<int>(PubMemContainer.YiooyiDB, sql, pb.GetParams());
            
            return tag;
        }
    }
}
